import React,{useEffect} from 'react'
import {Outlet,useLocation,useNavigate} from "react-router-dom"
import Tabbar from "@/components/Tabbar/Tabbar"
import {useToast1} from "@/utils/toast" 

export default function App()   {
  let toast = useToast1()
  let navigate = useNavigate()
  let location = useLocation()
  let token = localStorage.getItem("token")
  useEffect(()=>{
      if(!token){
        toast("error","请先登录")
        navigate("/login")
      }
    },[location.pathname])
  return (
    <div>
        {
          token?
          (
            <>
              <Outlet></Outlet>
              <Tabbar></Tabbar>
            </>
          ):
          (
            <div className='bot'></div>
          )
        }
    </div>

  )
}
function useToast() {
  throw new Error('Function not implemented.')
}

